package com.nuonuo.controller;

import com.nuonuo.entity.RestResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author duan
 * @version 1.0
 * @date 2023/11/1 16:01
 */

@RestController
@RequestMapping(value = "/")
public class InvoiceMockController {

    @PostMapping(value = "/open/invoice/callback.do")
    public RestResponse callbackMock(@RequestBody String params) {
        if (StringUtils.isBlank(params)) {
            return RestResponse.error("500", "参数不能为空");
        }
        return RestResponse.success("操作成功");
    }

    @PostMapping(value = "/open/zzs_kpfw/fpkj/{taxNum}")
    public RestResponse statistics(@PathVariable String taxNum, @RequestBody String params) {
        if ("1111222233334444".equalsIgnoreCase(taxNum)) {
            Map<String, String> map = new HashMap<String, String>();
            map.put("code", "0001");
            map.put("message", "系统异常");
            return RestResponse.buildObj(map);
        }
        return RestResponse.success("操作成功", "OK");
    }
}
